package set;

import linkedlist.LinkedList;

/**
 * @author linzou@linkdoc.com
 * @ClassName: LinkedListSet
 * @Description:
 * @date 2019/2/19 8:04 AM
 */
public class LinkedListSet<E> implements Set<E> {


    private LinkedList<E> list;

    public LinkedListSet(){
        this.list = new LinkedList<>();
    }

    @Override
    public void add(E e) {
        if(!this.list.contains(e)){
            this.list.addFrist(e);
        }
    }

    @Override
    public void remove(E e) {
        this.list.removeElement(e);
    }

    @Override
    public boolean contains(E e) {
        return this.list.contains(e);
    }

    @Override
    public int getSize() {
        return this.list.getSize();
    }

    @Override
    public boolean isEmpty() {
        return this.list.isEmpty();
    }
}
